package com.servicerequest.impl;

import java.io.InputStream;
import java.util.Map;

import com.servicerequest.model.HttpStatus;
import com.servicerequest.model.ServiceRequest;
import com.servicerequest.model.ServiceResponse;

public class ServiceResponseImpl implements ServiceResponse {

	private final ServiceRequest request;
	private final HttpStatus status;
	private final Map<String, String> headers;
	private final String body;
	private final InputStream content;

	public ServiceResponseImpl(ServiceRequest request, int code, Map<String, String> headers, String body, InputStream stream) {
		this.request = request;
		this.status = HttpStatus.valueOf(code);
		this.headers = headers;
		this.body = body;
		this.content = stream;
	}

	@Override
	public ServiceRequest getServiceRequest() {
		return request;
	}

	@Override
	public String getBody() {
		return body;
	}

	@Override
	public InputStream getStream() {
		return content;
	}

	@Override
	public HttpStatus getStatus() {
		return status;
	}

	@Override
	public Map<String, String> getHeaders() {
		return headers;
	}
}
